#include<bits/stdc++.h>
#define int long long 
using namespace std;
int n,L,ans;
int a[25],b[25];
void dfs(int x,int now,int sum){
	if(x>n){
		if(now<=L)ans=max(ans,sum);
		return;
	}
	dfs(x+1,now^a[x],sum^b[x]);
	dfs(x+1,now,sum);
}
signed main(){
	freopen("lock.in","r",stdin);
	freopen("lock.out","w",stdout);
	cin>>n>>L;
	for(int i=1;i<=n;i++)cin>>a[i]>>b[i];
	dfs(1,0,0);
	cout<<ans;
	return 0;
} 
